package adv7;

public class Worker extends Thread {
	public Worker(String n) {
		super(n);
	}

	@Override
	public void run() {
		System.out.println("工人" + super.getName() + "干活了");

		while (true) {
			System.out.println(super.getName() + "干了一会。。。睡一会");
			try {
				super.sleep(1000);// 一秒
				System.out.println("睡到自然醒，继续干活");
			} catch (InterruptedException e) {
				// 吵醒
				System.out.println("被地主吵醒");
				e.printStackTrace();
			}
		}

	}
}
